<%-- 
    Document   : listTransporte
    Created on : 23/05/2014, 11:41:45 AM
    Author     : USUARIO
--%>

<%@page import="Beans.*"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>AdminLTE | Dashboard</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="../../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="../../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="../../css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
        <link href="../../css/AdminLTE.css" rel="stylesheet" type="text/css" />
        <!-- DATA TABLES -->
        <link href="../../css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />

    </head>
    <body class="skin-blue">   
        
        <!-- header logo: style can be found in header.less -->
        <%@include file="../../jspf/header.jspf" %>
        <!-- header logo: style can be found in header.less -->
        
        
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">                
                <!-- sidebar: style can be found in sidebar.less -->
                <section class="sidebar">
                    <!-- Sidebar user panel -->
                    <div class="user-panel">
                        <div class="pull-left image">
                            <img src="../../img/avatar3.png" class="img-circle" alt="User Image" />
                        </div>
                        <div class="pull-left info">
                            <p>Hello, Jane</p>

                            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                        </div>
                    </div>
                    <!-- search form -->
                    <form action="#" method="get" class="sidebar-form">
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search..."/>
                            <span class="input-group-btn">
                                <button type='submit' name='seach' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>
                    <!-- /.search form -->
                    
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    <%@include file="../../jspf/menu.jspf" %>
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    
                </section>
                <!-- /.sidebar -->
            </aside>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Vehículos
                        <small>Mantenedor</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
                        <li class="active">Vehículo</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <h3 class="box-title">Listado de Vehículos</h3>                                    
                                </div><!-- /.box-header -->
                                <div class="box-footer">
                                    <a href="newEditVehiculo.jsp">
                                        <button type="submit" class="btn btn-primary">Nuevo Vehículo</button>
                                    </a>                                    
                                </div>
                                <div class="box-body table-responsive">
                                    <table id="example1" class="table table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th>N°</th>
                                                <th>Código</th>
                                                <th>Placa</th>
                                                <th>Modelo</th>
                                                <th>Bus/Carga</th>
                                                <th>Tipo de Bus/Carga</th>
                                                <th>Acciones</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <% ArrayList<ModVeh_Vehiculo> lista = new ModVeh_Vehiculo().listarVehiculos();
                                               for(int i=0; i<lista.size(); i++)
                                               {    ModVeh_Bus b = new ModVeh_Bus().obtenerBus(lista.get(i).getIdvehiculo());
                                                    ModVeh_Carga c = new ModVeh_Carga().obtenerCarga(lista.get(i).getIdvehiculo());
                                            %>
                                            <tr>
                                                <td><%=(i+1)%></td>
                                                <td><%=lista.get(i).getIdvehiculo()%></td>
                                                <td><%=lista.get(i).getPlaca()%></td>
                                                <td><%=lista.get(i).getModelo()%></td>
                                                <%  
                                                    if(b != null)
                                                    {
                                                %>
                                                <td><%=b.getNombre()%></td>
                                                    <%ModVeh_TipoDeBus tp = new ModVeh_TipoDeBus().obtenerTipoBus(b.getIdtipobus());%>
                                                <td><%=tp.getNombre()%></td>
                                                <td>
                                                    <a href="#">
                                                        <button type="button" style="background:none;border:none;margin-right:20px;" title="Editar Tipo de Bus">
                                                            <img src="../../img/edit.png" width="24" height="24"/>
                                                        </button>
                                                    </a>
                                                    <a href="#">
                                                        <button type="button" style="background:none;border:none;margin-right:20px;" title="Habilitar Tipo de Bus">
                                                            <img src="../../img/on.png" width="24" height="24"/>
                                                        </button>
                                                    </a>
                                                </td>
                                            <%
                                                    } else if (c != null)
                                                    {   
                                            %>
                                                <td><%=c.getNombre()%></td>
                                                <td>---</td>
                                                <td>
                                                    <a href="#">
                                                        <button type="button" style="background:none;border:none;margin-right:20px;" title="Editar Tipo de Bus">
                                                            <img src="../../img/edit.png" width="24" height="24"/>
                                                        </button>
                                                    </a>
                                                    <a href="#">
                                                        <button type="button" style="background:none;border:none;margin-right:20px;" title="Habilitar Tipo de Bus">
                                                            <img src="../../img/on.png" width="24" height="24"/>
                                                        </button>
                                                    </a>
                                                </td>  
                                            <%
                                                    }
                                            %>                                             
                                            </tr>
                                            <%                                                  
                                                }
                                            %>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <th>N°</th>
                                                <th>Código</th>
                                                <th>Placa</th>
                                                <th>Modelo</th>
                                                <th>Bus/Carga</th>
                                                <th>Tipo de Bus/Carga</th>
                                                <th>Acciones</th>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
                        </div>
                    </div>

                </section><!-- /.content -->    
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
        <script src="../../js/jquery.min.js"></script>
        <!-- Bootstrap -->
        <script src="../../js/bootstrap.min.js" type="text/javascript"></script>
        <!-- AdminLTE App -->
        <script src="../../js/app.js" type="text/javascript"></script>
        <!-- DATA TABES SCRIPT -->
        <script src="../../js/datatables/jquery.dataTables.js" type="text/javascript"></script>
        <script src="../../js/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
        <!-- page script -->
        <script type="text/javascript">
            $(function() {
                $("#example1").dataTable();
                $('#example2').dataTable({
                    "bPaginate": true,
                    "bLengthChange": false,
                    "bFilter": false,
                    "bSort": true,
                    "bInfo": true,
                    "bAutoWidth": false
                });
            });
        </script>
    </body>
</html>